PRINT '-------------------------------------------'
PRINT 'Starting execution of UM_UserAuthInfo.SQL'
PRINT '-------------------------------------------'
GO

SET QUOTED_IDENTIFIER OFF
SET ANSI_NULLS ON         -- We don't want (NULL = NULL) == TRUE
GO
SET ANSI_PADDING ON
GO
SET ANSI_NULL_DFLT_ON ON
GO




IF (NOT EXISTS (SELECT name
                FROM sysobjects
                WHERE (name = N'UM_UserAuthInfo')
                  AND (type = 'U')))
BEGIN
	  CREATE TABLE [dbo].[UM_UserAuthInfo](
			[ApplicationId] [uniqueidentifier] NOT NULL FOREIGN KEY REFERENCES dbo.aspnet_Applications(ApplicationId),
			[UserId] [uniqueidentifier] NOT NULL FOREIGN KEY REFERENCES dbo.aspnet_Users(UserId),			
			[AuthServiceProviderId] [smallint] NOT NULL FOREIGN KEY REFERENCES dbo.UM_AuthServiceProviders(AuthServiceProviderId),
			[AuthServiceProviderUId] [varchar](200) NOT NULL,
			[LoginProviderId] [smallint] NOT NULL FOREIGN KEY REFERENCES dbo.UM_LoginProviders(LoginProviderId),
			[LoginProviderUId] [varchar](200) NOT NULL,
			[ProfileUrl] [varchar](256) NULL,
			[ProfilePicUrl] [varchar](256) NULL,
		 CONSTRAINT [PK_UM_UserAuthInfo] PRIMARY KEY CLUSTERED 
		(
			[ApplicationId] ASC,
			[UserId] ASC,
			[LoginProviderId] ASC
		)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
		) ON [PRIMARY]
END
GO



PRINT '--------------------------------------------'
PRINT 'Completed execution of UM_UserAuthInfo.SQL'
PRINT '--------------------------------------------'

